﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FirmaTransportowa
{
    public partial class AdminPanelForm : Form
    {
        private AdminPanelPresenter presenter;

        public AdminPanelForm(AdminPanelPresenter presenter)
        {
            InitializeComponent();
            this.presenter = presenter;
        }

        private void nowaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AdminAddNewUser adminAddNewUser = new AdminAddNewUser();
            adminAddNewUser.Show();
        }

        private void dodajToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AdminAddNewWorker adminAddNewWorker = new AdminAddNewWorker();
            adminAddNewWorker.Show();
        }

        private void pracownikToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                Application.Exit();
            }
        }

        private void AdminPanel_Load(object sender, EventArgs e)
        {

        }

        private void userButton_Click(object sender, EventArgs e)
        {
            AdminPanelUserView adminPanelUserView = new AdminPanelUserView();
            adminPanelUserView.Show();
        }

        private void workerButton_Click(object sender, EventArgs e)
        {
            AdminPanelWorkerView adminPanelWorkerView = new AdminPanelWorkerView();
            adminPanelWorkerView.Show();
        }

        private void carButton_Click(object sender, EventArgs e)
        {
            AdminPanelCarView adminPanelCarView = new AdminPanelCarView();
            adminPanelCarView.Show();
        }

        private void logout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Dispose();
            LoginPresenter.showLoginView();
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            adminDateAndTime.Text = DateTime.Now.ToString();
        }

        private void AdminPanelForm_HelpButtonClicked(object sender, CancelEventArgs e)
        {
            HelpUtils.showHelp(this, 12);
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.F1)
            {
                HelpUtils.showHelp(this, 12);
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}
